package com.twu.biblioteca.model;

import java.util.ArrayList;
import java.util.List;

public class Customer {
    private final String libraryNumber;
    private final String password;
    private final String name;
    private final ContactInformation contactInformation;
    private final List<LibraryItem> checkedOutItems;

    public Customer(String libraryNumber, String password, String name, ContactInformation contactInformation) {
        if (!libraryNumber.matches("[0-9]{3}-[0-9]{4}"))
            throw new IllegalArgumentException("Invalid Library Number: " + libraryNumber);
        this.libraryNumber = libraryNumber;
        this.password = password;
        this.name = name;
        this.contactInformation = contactInformation;
        this.checkedOutItems = new ArrayList<>();
    }

    public String getLibraryNumber() {
        return libraryNumber;
    }

    public String getPassword() {
        return password;
    }

    public String getName() {
        return name;
    }

    public ContactInformation getContactInformation() {
        return contactInformation;
    }

    public List<LibraryItem> getCheckedOutItems() {
        return checkedOutItems;
    }

    @Override
    public String toString() {
        return "Name: " + this.name + "\n" +
                "Password: " + this.password + "\n" +
                "Library Number: " + this.libraryNumber + "\n" +
                this.contactInformation.toString() + "\n";
    }
}
